package com.ssm.service.Impl;


import com.ssm.entity.MyUser;
import com.ssm.entity.UserProfile;
import com.ssm.mapper.UserProfileMapper;
import com.ssm.mapper.UsersMapper;
import com.ssm.service.MyUserService;
import com.ssm.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.security.RolesAllowed;
import java.util.Set;

@Service
public class MyUserServiceImpl implements MyUserService {
	@Autowired
	private UsersMapper userdao;
	@Autowired
	private UserProfileMapper userProfileMapper;

	@Override
	public MyUser getUserByName(String name) {
		return userdao.getUserByName(name);
	}

	@Override
	public ResultUtils getUserRoleAllByUserId(Long userId) {
		Set<UserProfile> userProfiles = userProfileMapper.getUserRoleAllByUserId(userId);
		return ResultUtils.ok(userProfiles);
	}

	@RolesAllowed("ROLE_ADMIN")
	@Override
	public String getUser(String name) {
		System.out.println("abv");
		return name;
	}





}
